/**
 * #resize
 * rightShow === true
 */
export default {
  data(){
    return{
      differWidth:0,
      resizeDifferWidth:0,
    }
  },
  mounted(){
    this.resize()
  },
  methods:{
    resize(){
      const resizeDom = document.getElementById('resize')
      resizeDom.onmousedown = e =>{
        if(!this.rightShow)
          return
        console.log("....")
        const startX = e.clientX - this.differWidth;
        resizeDom.style.borderLeft="2px dotted"
        //防抖版-配合transtion
        /*document.onmousemove =  this._debounce(e=>{
          console.log("触发")
          let {clientX} = e
          if(clientX<150)
            clientX = 150
          if(clientX>window.innerWidth-150)
            clientX = window.innerWidth-150
          this.resizeDifferWidth = clientX - startX
          console.log(this.resizeDifferWidth)
        },20) */
        document.onmousemove = e =>{
          const {clientX} = e
          
          if(clientX>=150 && clientX<=window.innerWidth-150 && this.rightShow)
            this.resizeDifferWidth = clientX - startX
          console.log({clientX,startX,resizeDifferWidth:this.resizeDifferWidth})
        }
        document.onmouseup = e =>{
          console.log({e})
          resizeDom.style.borderLeft="none"
          this.differWidth = this.resizeDifferWidth
          document.onmousemove = null;
          document.onmouseup = null; 
          resize.releaseCapture && resize.releaseCapture();
        }
        resize.setCapture && resize.setCapture();
        return false
      }
    },
  }
}